#ifndef MERGEIMG_H
#define MERGEIMG_H
#include <QObject>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>
using namespace cv;
using namespace std;
class MergeImg : public QObject
{
    Q_OBJECT
public:
    explicit MergeImg(QObject *parent = nullptr);
    MergeImg(std::string baseImg, std::vector<vector<cv::Point>> pArr);
    void Merge(std::string imgPath, int i);
    ~MergeImg();

private:
    void fillMaskPoints(cv::Rect sourceRect, int i);
    Point GetResultPt(cv::Rect sourceRect, int i);
    void CopyImgBuyMask(int x, int y, cv::Rect &sourceRect, cv::Mat &mask, cv::Mat &src, int i);
private:
    std::vector<vector<cv::Point>> rotatedpointArr;
    std::vector<vector<cv::Point>> maskpointArr;
    Point2f prevPt;//
    Mat dstImg;
//幕布的边缘填充
    int top = 0;
    int bottom = 1700;
    int left = 500;
    int right = 600;
};
#endif // MERGEIMG_H
